// Copyright [2020] <unknown>

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
// #define ONLINE_JUDGE

struct P {
    int x, y;
    P(int x = 0, int y = 0) : x(x), y(y) {}
    bool operator<(const P &other) const {
        return x != other.x ? x < other.x : y < other.y;
    }
};
#ifndef ONLINE_JUDGE
#define dbg(x...)                             \
    {                                         \
        cerr << "\033[32;1m" << #x << " -> "; \
        err(x);                               \
    }
void err() { cerr << "\033[39;0m" << endl; }
template <typename T, typename... A>
void err(T a, A... x) {
    cerr << a << ' ';
    err(x...);
}
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

const int N = 4e5 + 50, M = 25;

LL cnt[M];
int a[N], n;
int b[N];

struct bit {
    int dat[N << 1];
    inline int lowbit(int x) {
        return x & (-x);
    }
    void clear(int n) {
        memset(dat, 0, sizeof(int) * (n+1));
    }

    inline void add(int i) {
        for (; i < (N << 1); i+=lowbit(i))
            dat[i]++;
    }
    inline LL sum(int i) {
        LL res = 0;
        for (; i; i-=lowbit(i))
            res += dat[i];
        return res;
    }
};

LL doit(int a[], int n, int tv) {
    static int b[N << 1], bcnt, c[N][2], ccnt;
    static bit bit;
    bcnt = 0;
    for (int i = 0; i < n; ++i) {
        b[bcnt++] = a[i];
        if (tv - a[i] >= 0)
            b[bcnt++] = tv - a[i];
    }
    sort(b, b + bcnt);
    bcnt = unique(b, b + bcnt) - b;
    for (int i = 0; i < n; ++i) {
        c[i][0] = lower_bound(b, b + bcnt, a[i]) - b + 1;
        if (tv - a[i] >= 0)
            c[i][1] = lower_bound(b, b + bcnt, tv - a[i]) - b + 1;
    }
    // dbg("St");
    bit.clear(bcnt);
    LL res = 0;
    for (int i = 0; i < n; ++i) {
        if (tv - a[i] < 0) {
            res += i;
            bit.add(c[i][0]);
            continue;
        }
        int cnt = i - bit.sum(c[i][1] - 1);
        res += cnt;
        bit.add(c[i][0]);
    }

    return res;
}

int solve(int k) {
    // dbg(k);
    int mask = (1 << (k)) - 1;
    LL cnt = 0;

    int c[2] = {0, 0};
    for (int i = n - 1; i >= 0; --i) {
        int id = (a[i] >> k) & 1;
        cnt += c[id ^ 1];
        ++c[id];
    }

    for (int i = 0; i < n; ++i) {
        b[i] = a[i] & mask;
    }
    int tv = 1 << k;
    // dbg(k);
    cnt += doit(b, n, tv);
    if (cnt & 1) return tv;
    else
        return 0;
}

int check(int a[], int n) {
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j)
            ans ^= (a[i] + a[j]);
    }
    return ans;
}

int main(int argc, char const *argv[]) {
    // tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> tr;
    // for (int i = 0; i < 3; ++i) tr.insert(i);
    // cout << tr.order_of_key(4) << endl;
    // cout << tr.order_of_key(-1) << endl;
    // for (int x : tr)
    //     cout << x << endl;
    // return 0;

    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }
    LL ans = 0;

    int cnt[2] = {0, 0};
    for (int i = n - 1; i >= 0; --i) {
        int id = a[i] & 1;
        ans += cnt[id ^ 1];
        ++cnt[id];
    }
    ans %= 2;
    // dbg(ans);
    for (int i = 1; i < M; ++i)
        ans += solve(i);
    cout << ans << endl;
    // dbg(check(a, n));
    // assert(ans == check(a, n));
    return 0;
}
